<?php   
	/*
	 *      Sample Module template for "OH"
	 *  
	 *  use for write develop module interface
	 *  to encampusulate opensource script into "OH"
	 */
	
	// Interface function   
	function oh_module_htpasswdx($tokens) {
        global $oh_object_htpasswdx;
        return $oh_object_htpasswdx;        
	} 
	
	// Option file required
	require_once($oh['path']."/modules/htpasswdx/htpasswd.class.php");
	
	// Main class of module
	class oh_class_htpasswdx {
        function oh_class_htpasswdx() {
        	
        }
        function add($file,$username,$password) {
        	if (!file_exists($file)) {
        		file_put_contents($file,"");	
        	} 
        	$handle = new Htpasswd($file);
        	oh_dump($password);
        	$handle->addUser($username,$password);
        }
        function del($file,$username) {
        	if (!file_exists($file)) {
        		file_put_contents($file,"");	
        	} 
        	$handle = new Htpasswd($file);
        	$handle->deleteUser($username);
        }
	}
	
	// Main object of module
	global $oh_object_htpasswdx;
	$oh_object_htpasswdx = new oh_class_htpasswdx();
?>
